<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var isPalindrome = function (x) {
        if (x < 0 || (x % 10 === 0 && x != 0)) return false
        let a = 0
        while (x > a) {
          a = a * 10 + (x % 10)
          x = parseInt(x / 10)
        }
        return x === a || x === parseInt(a / 10)
      }
      console.log(isPalindrome(12321))
    </script>
  </body>
</html>
